package com.iwhalecloud.bss.kite.cucc.service.attr.handler;

import com.iwhalecloud.bss.kite.common.constant.ServiceOfferConsts;
import com.iwhalecloud.bss.kite.common.util.KiteStringUtils;
import com.iwhalecloud.bss.kite.cucc.common.constant.LocalKeyConsts;
import com.iwhalecloud.bss.kite.cucc.common.constant.LocalServiceOfferConsts;
import com.iwhalecloud.bss.kite.manager.api.IOperateSceneInstService;
import com.iwhalecloud.bss.kite.manager.inst.KiteAttr;
import com.iwhalecloud.bss.kite.manager.inst.KiteInst;
import com.iwhalecloud.bss.kite.service.attr.AttrData;
import com.iwhalecloud.bss.kite.service.attr.handler.AbstractAttrHandler;
import com.ztesoft.bss.common.util.ContextUtil;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Description:客户申请IPV4地址数量、客户申请IPV6地址数量处理类
 * File Name:IPAddressesNumberAttrHandler
 * Modification History:
 * Date             Author      Version     Description
 * ------------------------------------------------------------------
 * 2021-11-24 11:02   邱萌         1.0       1.0 Version
 **/
public class IPAddressesNumberAttrHandler extends AbstractAttrHandler {
    @Autowired
    IOperateSceneInstService operateSceneInstService;

    @Override
    public void after(KiteAttr attr, KiteInst inst, AttrData data) {
        String provinceCode = ContextUtil.getLoginInfo().getUserInfo().getPostProvinceNbr();
        if (LocalKeyConsts.PROVINCE_HEBEI.equals(provinceCode) && KiteStringUtils.equalsAny(data.getServiceOfferId(), ServiceOfferConsts.SERVICE_OFFER_ORDER,
            LocalServiceOfferConsts.SERVICE_OFFER_RESOURCE_CHECK)) {
            //客户申请IPv4地址数量、客户申请IPV6地址数量
            if (KiteStringUtils.equalsAny(attr.getFieldName(),"2_0000193","2_0000194")) {
                attr.setDefaultValue("0");
            }
        }
    }
}
